/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package no.ffi.fca.db.result;

import java.util.ArrayList;
import java.util.Date;

/**
 *
 * @author stian
 */
public class CertificateList {

    public static class Certificate {
        public int id;
        public int uid;
        public String name;
        public String subject;
        public String hash;
        public String hash_old;
        public String serial;
        public Date nvb;
        public Date nva;
        public String type;
        public boolean revoked;
        public String ticket;
        
        public Certificate(
                int id, 
                int uid, 
                String name, 
                String subject, 
                String hash, 
                String hash_old, 
                String serial, 
                long nvb, 
                long nva, 
                String type,
                int revoked,
                String ticket) {
            this.id = id;
            this.uid = uid;
            this.name = name;
            this.subject = subject;
            this.hash = hash;
            this.hash_old = hash_old;
            this.serial = serial;
            this.nvb = new Date(nvb);
            this.nva = new Date(nva);
            this.type = type;
            this.revoked = revoked == 1;
            this.ticket = ticket;
        }
    }
    
    public ArrayList<Certificate> certificateList;
    
    public CertificateList() {
        certificateList = new ArrayList<Certificate>();
    }
    
    public void add(int id, int uid, String name, String subject, String hash, String hash_old, String serial, long nvb, long nva, String type, int revoked, String ticket) {
        certificateList.add(new Certificate(id, uid, name, subject, hash, hash_old, serial, nvb, nva, type, revoked, ticket));
    }
}
